package com.lhx.crud.controller;

import com.lhx.crud.bean.Department;
import com.lhx.crud.bean.MSG;
import com.lhx.crud.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class DepartmentController {
    @Autowired
    private DepartmentService  departmentService;

    //获取部门信息
    @RequestMapping("/depts")
    @ResponseBody
    public MSG getAll(){
        //用list接受数据
        List<Department> depts = departmentService.getAll();
        return MSG.success().add("depts",depts);


    }




}
